package com.aosiding.yygh.msm.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ConstantPropertiesUtils implements InitializingBean {

    @Value("${aliyun.sms.regionId}")
    private String regionId;

    @Value("${aliyun.sms.accessKeyId}")
    private String accessKeyId;

    @Value("${aliyun.sms.secret}")
    private String secret;

    @Value("${spring.mail.host}")
    private String emailHost;

    @Value("${spring.mail.username}")
    private String emailName;

    @Value("${spring.mail.password}")
    private String emailPassword;

    //因为上面属性为private,外面要引用，则使用static
    //手机
    public static String REGION_Id;
    public static String ACCESS_KEY_ID;
    public static String SECRECT;

    //邮箱
    public static String EMAIL_HOST;
    public static String EMAIL_NAME;
    public static String EMAIL_PASSWORD;

    @Override
    public void afterPropertiesSet() throws Exception {
        REGION_Id=regionId;
        ACCESS_KEY_ID=accessKeyId;
        SECRECT=secret;
        EMAIL_HOST=emailHost;
        EMAIL_NAME=emailName;
        EMAIL_PASSWORD=emailPassword;
    }
}
